import { http } from '@/utils/http'

const AUTH_BASE_URL = '/core/config'

// 配置信息codeType
export enum ConfigType {
  PROD_HEAD = 'tProdheadStatus',
  PROD_CODE = 'productCode',
  PAYMENT_TERMS = 'paymentTerms',
  TRANSACTION_TERMS = 'transactionTerms',
  MOVE_CATEGORY = 'moveCategory',
  WAREHOUSE_CODE = 'warehouseCode',
  PURCHASE_CATEGORY = 'purchaseCategory',
  WAREHOUSE_TYPE = 'warehouseType',
  TRAN_IN_REASON = 'tranInReason',
  TRAN_OUT_REASON = 'tranOutReason',
  UNIT = 'unit',
}

const configApi = {
  // 查询单个配置信息
  getConfigInfo: (codeType?: ConfigType) => {
    return http<ConfigData[]>({
      url: `${AUTH_BASE_URL}/getConfigListByType?codeType=${codeType}`,
      method: 'GET',
    })
  },
}

export default configApi

export interface ConfigData {
  codeName: string
  codeType: string
  codeValue: string
  createTime: string
  remark: null
  remark1: null
  remark2: null
  remark3: null
  sort: null
  updateTime: string
}
